unit AboutUnit;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls, AAFont, AACtrls, jpeg, SUISkinEngine, IniFiles;

type
  TAboutForm = class(TForm)
    Image1: TImage;
    suiSkinEngine1: TsuiSkinEngine;
    lbl_ver: TAALabel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Image1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  AboutForm: TAboutForm;
  function Get_Version:String;

implementation

{$R *.dfm}

procedure TAboutForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  //Action := caFree;
end;

procedure TAboutForm.Image1Click(Sender: TObject);
begin
  Close;
end;

procedure TAboutForm.FormCreate(Sender: TObject);
var
  UseSkin,SkinFileName:String;
begin
  with TIniFile.Create(ExtractFilePath(Application.ExeName)+'SkinSet.INI') do
  begin
    try
      UseSkin := Trim(ReadString('SKIN_SET','USESKIN','1'));
      SkinFileName := ReadString('SKIN_SET','SKINFILENAME','') ;

      if UseSkin='0' then
      begin
        SkinFileName := '';
        suiSkinEngine1.Active := False;
        Exit;
      end;

      if SkinFileName='' then
        UseSkin := '0'
      else
        SkinFileName := ExtractFilePath(Application.ExeName)+SkinFileName;
      if FileExists(SkinFileName) then
      begin
        suiSkinEngine1.SkinFile := SkinFileName;
        suiSkinEngine1.Active := UseSkin='1';
      end else
      begin
        suiSkinEngine1.SkinFile := '';
        if not suiSkinEngine1.Ready then
          suiSkinEngine1.Active := False
        else
          suiSkinEngine1.Active := True;
      end;

    finally
      Free;
    end;
  end;
  lbl_ver.Caption := 'Ver: '+Get_Version;
end;

function Get_Version: String;
var
  VerInfoSize,VerValueSize,Dummy:Dword;
  VerInfo:Pointer;
  VerValue:PVSFixedFileInfo;
  sVer:String;V1,V2,V3,V4:word;
begin
  try
  sVer := ParamStr(0);
  VerInfoSize:=GetFileVersionInfoSize(Pchar(sVer),Dummy);
  sVer := '';
  GetMem(VerInfo,VerInfoSize);
  GetFileVersionInfo(PChar(ParamStr(0)),0,VerInfoSize,VerInfo);
  VerQueryValue(VerInfo,'\',Pointer(VerValue),VerValueSize);
  With   VerValue^   do
  begin
      V1:=dwFileVersionMS   shr   16;
      V2:=dwFileVersionMS   and   $FFFF;
      V3:=dwFileVersionLS   shr   16;
      V4:=dwFileVersionLS   and   $FFFF;
  end;
  FreeMem(VerInfo,VerInfoSize);
  sVer:=IntToStr(V1) + '.' + IntToStr(V2)+ '.' + IntToStr(V3) + '.'+IntToStr(V4);
  Result := sVer;
  except
  FreeMem(VerInfo,VerInfoSize);
  end;
end;

end.

